from dubbo_client import ZookeeperRegistry, DubboClient, ApplicationConfig
from flask import Flask

app = Flask(__name__)
config = ApplicationConfig("my_config")
registry = ZookeeperRegistry('localhost:2181', config)
provider_hello = DubboClient('com.example.dubbo.service.DubboSayHelloService', registry)
provider_hi = DubboClient("com.sanic.demo.Hi", registry)


@app.route("/hello/<name>")
def hello(name):
    return provider_hello.sayHello(name)


@app.route("/hi/<name>")
def hi(name):
    return provider_hi.hi(name)


if __name__ == '__main__':
    app.run(debug=True, port=8001)
